#include <stdio.h> 
#include <stdlib.h>
typedef struct BiNode{
	char data;
	struct BiNode *lchild,*rchild;
}BiTNode,*BiTree;
BiTree hlwBiTree(){
	char ch;
	ch=getchar();
	getchar();
	BiTree T=NULL;
	if(ch!='#'){
		T=(BiTNode*)malloc(sizeof(BiTNode));
		T->data=ch;
		T->lchild=hlwBiTree(T->lchild);
		T->rchild=hlwBiTree(T->rchild); 
	}
	return T; 
    	
}
void xmz(BiTNode *T){
	if(T){
		xmz(T->lchild);
		printf("%c",T->data);
		xmz(T->rchild);
	}
}
int main(){
	BiTree tree=NULL;
	tree=hlwBiTree();
	xmz(tree);
	return 0;
}